package com.treetao.union.db.service.impl;

import com.treetao.union.db.model.MallOrderPayrecord;
import com.treetao.union.db.Const.PayType;
import com.treetao.union.db.Const.PayWay;
import com.treetao.union.db.mapper.MallOrderPayrecordMapper;
import com.treetao.union.db.service.MallOrderPayrecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Date;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 支付结果记录 服务实现类
 * </p>
 *
 * @author Dev.M
 * @since 2020-04-11
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MallOrderPayrecordServiceImpl extends ServiceImpl<MallOrderPayrecordMapper, MallOrderPayrecord> implements MallOrderPayrecordService {

	@Override
	public boolean savePayWeixin(Long orderno, Double price, String xml) {
		MallOrderPayrecord op = new MallOrderPayrecord();
		op.setCallbackTime(new Date());
		op.setJson(xml);
		op.setOrderno(orderno);
		op.setPayWay(PayWay.WEIXIN);
		op.setPriceReal(price);
		op.setType(PayType.PAY);
		return save(op);
	}

}
